/**
 * 
 */

package com.xinxi11.module.core.web.struts2;

import java.util.Calendar;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.opensymphony.xwork2.ActionSupport;
import com.xinxi11.module.core.dao.Pagination;
import com.xinxi11.project.qx.user.ILoginUserInfo;
import com.xinxi11.project.qx.user.LoginUserUtils;

/**
 * 基本变量
 */
@SuppressWarnings( { "serial" })
public class Struts2ActionSupport extends ActionSupport {

	protected Logger log = LoggerFactory.getLogger(getClass());

	/** 进行CUD操作后,以redirect方式重新打开action默认页的result名. */
	public static final String RELOAD = "reload";
	/** 查看页面 */
	public static final String LOOK = "look";
	/** 添加页面 */
	public static final String SAVE = "save";
	/** 更新,修改页面 */
	public static final String UPDATE = "update";
	/** 搜索查询列表页面 */
	public static final String LIST = "list";
	/** 导出excel文件 */
	public static final String EXPORT_EXCEL = "exportExcel";
	/** 无权访问页面 */
	public static final String FORBIDEN = "forbiden";

	/** 页面参数 */
	public String sid;

	/** 分页参数 */
	public Integer pageIndex = 1;
	public Integer pageSize = 20;
	public Pagination page = new Pagination(pageIndex, pageSize);

	public String getSid() {
		return sid;
	}

	/**
	 * 前台页面传入的参数
	 * 
	 * @param sid
	 */
	public void setSid(String sid) {
		this.sid = sid;
	}

	public Integer getPageIndex() {
		return pageIndex;
	}

	public void setPageIndex(Integer pageIndex) {
		this.pageIndex = pageIndex;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Pagination getPage() {
		return page;
	}

	public void setPage(Pagination page) {
		this.page = page;
	}

	public Pagination getNewPage() {
		page = new Pagination(pageIndex, pageSize);
		return page;
	}

	/** 获取当前用户的基本信息 */
	public ILoginUserInfo getLoginUser() {
		return LoginUserUtils.getLoginUserInfo();
	}

	/** 获取系统当前时间 */
	public Date getToday() {
		return Calendar.getInstance().getTime();
	}

}
